package midas.mw;

import midas.mw.cfg.CfgError;

/**
 * MIDAS middleware class loader implementation.
 * Used to dynamically load MIDAS middleware components
 * and MIDAS applications. Based on using the java
 * standard class loader 'ClassLoader'
 */
public class MwClassLoader extends ClassLoader {
	
	/** Loaded class */
	Class cls;
  
	/**
	 * Get loaded class
	 */
    protected Class returnClass () {
      return cls;
    }

    /**
     * Overloading the 'ClassLoader' method 'loadClass()'.
     */
	protected Class loadClass(String name, boolean b) {
		Class cl = null;
		try {
			cl = super.loadClass(name, b);
		} catch (ClassNotFoundException e) {
			CfgError.errorReporting(CfgError.ERR_OPER, "MW_Core", CfgError.SEV_WARNING, 
//					"loadClass() Failed to load class '"+name+"'\n"+ e.getMessage(), null);
			"loadClass() Failed to load class '"+name+"'", null);
			return null;
		};
		return cl;
	}
}
